package com.example.myapplication333;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    public TextView text_1;
    private Button button_1;
    private Button button_2;
    private Button button_3;
    private Button button_4;
    private Button button_5;
    private Button button_6;
    private Button button_7;
    private Button button_8;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        text_1 = findViewById(R.id.textView);
        button_1 = (Button) findViewById(R.id.button1);
        button_2 = (Button) findViewById(R.id.button2);
        button_4 = (Button) findViewById(R.id.button4);
        button_5 = (Button) findViewById(R.id.button5);
        button_6 = (Button) findViewById(R.id.button6);
        button_7 = (Button) findViewById(R.id.button7);
        button_8 = (Button) findViewById(R.id.button8);
        button_1.setOnClickListener(this);
        button_2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                text_1.setText("匿名内部类");
            }
        });
        button_4.setOnClickListener(new OnClick());
        button_5.setOnClickListener(new MyClick(MainActivity.this, text_1));
        button_6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                text_1.setText("ButterKnife绑定");
            }
        });
        button_7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent(MainActivity .this,system_info .class) ;
                startActivity(intent);
            }
        });
        button_8.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent(MainActivity .this,simulate.class) ;
                startActivity(intent);
            }
        });


    }
    public  void click(View v)
        {
        text_1.setText("绑定到标签");
    }
    @Override
    public void onClick(View v) {
        text_1.setText("activity作为监听器");
    }
    class OnClick implements View.OnClickListener {
        @Override
        public void onClick(View v) {
                    text_1.setText("内部类");

        }
    }

}
